//
//  YCDataButton.m
//  lianganyuchu
//
//  Created by iMac on 17/2/22.
//  Copyright © 2017年 杭州桑缇电子商务有限公司. All rights reserved.
//

#import "YCDataButton.h"

@interface YCDataButton()
{
    UILabel *m_labTitle;
    UILabel *m_labCenter;
    UILabel *m_labBottom;
}
@end
@implementation YCDataButton

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addSubviewsWith:frame];
    }
    return self;
}
-(void)addSubviewsWith:(CGRect)frame
{
    CGSize sizeBtn=frame.size;
    
    m_labTitle=[[UILabel alloc]initWithFrame:CGRectMake(0, 20, sizeBtn.width, 20)];
    [m_labTitle setTextColor:TEXT_MIDDLE];
    [m_labTitle setFont:[UIFont LightFontOfSize:15]];
    [m_labTitle setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:m_labTitle];
    
    m_labCenter=[[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(m_labTitle.frame)+kSmallDistance, sizeBtn.width, 20)];
    [m_labCenter setTextColor:TEXT_DEEP];
    [m_labCenter setFont:[UIFont FontOfSize:22]];
    [m_labCenter setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:m_labCenter];
    
    m_labBottom=[[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(m_labCenter.frame)+kSmallDistance, sizeBtn.width, 20)];
    [m_labBottom setTextColor:TEXT_LIGHT];
    [m_labBottom setFont:[UIFont LightFontOfSize:12]];
    [m_labBottom setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:m_labBottom];
}
-(void)setButtonWithTitle:(NSString *)title Data:(NSString *)data Desc:(NSString *)desc
{
    [m_labTitle setText:title];
    [m_labCenter setText:data];
    [m_labBottom setText:desc];
    
    if (_isCenter) {
        [m_labCenter setTextColor:MAIN_COLOR];
    }
}


@end
